/*
 * CourseCreator.cpp
 *
 *  Created on: 14 May 2010
 *      Author: Savramis Sartios
 */

#include "CourseCreator.h"
#include "../../../Validators/CourseCodeValidator/CourseCodeValidator.h"
#include "../../../Validators/CourseTitleValidator/CourseTitleValidator.h"
#include "../../../Domain/CoursesAndTeachers/Contents/Courses/Course.h"


CourseCreator::CourseCreator() {


}

CourseCreator::~CourseCreator() {

}

ICourse	*	CourseCreator::getCourse(const string *courseCode,const string *courseTitle){
	if((0!=courseCode)&&(0!=courseTitle)){

		ICourseCodeValidator  *codeValidator = new CourseCodeValidator;
		ICourseTitleValidator *titleValidator = new CourseTitleValidator;


		ICourse	*course = new Course(codeValidator->checkCode(courseCode),titleValidator->checkTitle(courseTitle));

		delete codeValidator;
		delete titleValidator;

		return course;
	}
	throw;
}
